package channelInitialize

import (
	"gitee.com/fierce_wolf/go-fox-edge-channel-common/channelScheduler"
	"gitee.com/fierce_wolf/go-fox-edge-channel-common/entityManager"
	"gitee.com/fierce_wolf/go-fox-edge-common/commRedisStatus"
	"gitee.com/fierce_wolf/go-fox-edge-common/edgeEntity"
)

func Initialized() {
	Initialize(map[string]interface{}{})
}

func Initialize(others map[string]interface{}) {
	// 注册会用到的实体
	edgeEntity.Register()

	// 启动进程状态通知
	commRedisStatus.Instance()
	commRedisStatus.Scheduler()

	// 装载实体
	entityManager.Instance(others)
	entityManager.InitLoadEntity()

	// 启动独立的Topic发布线程：该线程不能阻塞
	channelScheduler.Scheduler()

	// 启动实体同步线程：该线程允许阻塞
	entityManager.Scheduler()
}
